home *** CD-ROM | disk | FTP | other *** search
- #include "exec/types.h"
- #include "intuition/intuition.h"
-
- #define INTUITION_REV 0
- #define GRAPHICS_REV 0
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct RastPort *rp;
- struct Window *image_window;
-
- USHORT chip imagedefs[]={0xffff,0x7ffe,0xbffd,0xdffb,
- 0xeff7,0xf7ef,0xffff,0xffff,
- 0xffff,0xffff,0xf7ef,0xeff7,
- 0xdffb,0xbffd,0x7ffe,0xffff};
-
- struct Image myimage={0,0,16,16,3,&imagedefs[0],0x1,0x0,NULL};
-
- main()
- {
- ULONG flags;
- SHORT x,y,w,h;
- UBYTE color0,color1,*name;
- int i;
-
- OpenLibs();
-
- x=y=0;
- w=640;
- h=200;
- name=" Image Example Window";
- flags=ACTIVATE|SMART_REFRESH;
- color0=0x0000;
- color1=0x0001;
- image_window=(struct Window*)make_window(x,y,w,h,name,flags,color0,color1,NULL,NULL);
- rp=image_window->RPort;
-
- DrawImage(rp,&myimage,302,90);
-
- Delay(500);
- CloseWindow(image_window);
- CloseLibrary(IntuitionBase);
- };
-
- make_window(x,y,w,h,name,flags,color0,color1,screen)
- SHORT x,y,w,h;
- UBYTE *name,color0,color1;
- ULONG flags;
- struct Screen *screen;
- {
- struct NewWindow NewWindow;
- NewWindow.LeftEdge = x;
- NewWindow.TopEdge = y;
- NewWindow.Width = w;
- NewWindow.Height = h;
- NewWindow.DetailPen = color0;
- NewWindow.BlockPen = color1;
- NewWindow.Title = name;
- NewWindow.Flags = flags;
- NewWindow.IDCMPFlags = CLOSEWINDOW|VANILLAKEY;
- if(screen==NULL)
- NewWindow.Type=WBENCHSCREEN;
- else
- {
- NewWindow.Type=CUSTOMSCREEN;
- NewWindow.Screen=screen;
- }
- NewWindow.FirstGadget = NULL;
- NewWindow.CheckMark = NULL;
- NewWindow.BitMap = NULL;
- NewWindow.MinWidth = 10;
- NewWindow.MinHeight = 10;
- NewWindow.MaxWidth = 640;
- NewWindow.MaxHeight = 200;
- return(OpenWindow(&NewWindow));
- }
-
- OpenLibs()
- {
- IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library",0);
- if(IntuitionBase==NULL)
- {
- printf("Can't Open Intuition Library... Aborting !");
- exit(FALSE);
- }
-
- GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",0);
- if(GfxBase==NULL)
- {
- printf("Can't Open Graphics Library... Closing Intuition... Aborting !");
- CloseLibrary(IntuitionBase);
- exit(FALSE);
- }
- return(NULL);
- }
-
-